using System;
using System.Collections.Generic;
using System.Text;
using Chat.Util;

namespace Chat.Server
{
    class MessageReceive
    {
        
        public static User getUser(byte[] data)
        {
            User u = new User();
            //if (checkBoot(data))
            //{
            //    string ip = getUserIp(data);
            //    string name = getUserName(data);
            //    u.ip = ip;
            //    u.id = name;
            //    u.name = name;
            ///}
            return u;
        }


        public static FromMsg getFromString(Head h, byte[] bBody)
        {
            FromMsg fm = new FromMsg();
            fm.fromId = h.id;
            fm.fromIp = h.ip;
            fm.fromName = h.name;
            fm.msg = Tools.getString(bBody);
            return fm;
        }

        public static ToMsg getSendString(Head h, byte[] bBody)
        {
            ToMsg tm = new ToMsg();
            tm.toId = h.id;
            tm.toIp = h.ip;
            tm.toName = h.name;
            tm.msg = Tools.getString(bBody);
            return tm;
        }



    }
}
